import { createStore, combineReducers, applyMiddleware } from "redux";
import { composeWithDevTools } from "redux-devtools-extension";
import ReduxThunk from "redux-thunk";

const LOGOUT = "logout";
const userInitialState = {};

export function logout() {}

function userReducer(state = userInitialState, action) {
  switch (action.type) {
    case LOGOUT: {
      return {};
    }
    default:
      return state;
  }
}

const allReducers = combineReducers({
  user: userReducer,
});

export default function initialStore(state) {
  const store = createStore(
    allReducers,
    { ...userInitialState, ...state },
    composeWithDevTools(applyMiddleware(ReduxThunk))
  );

  return store;
}
